package cn.edu.seu.ssny.exception;

import cn.edu.seu.ssny.enums.ResultCodeEnum;
import lombok.Getter;

@Getter
public class SsnyException extends RuntimeException {

    public int code;

    public SsnyException(int code, String message) {
        super(message);
        this.code = code;
    }


    public SsnyException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "SsnyException{" +
                "code=" + code +
                ", message=" + getMessage() +
                '}';
    }
}
